﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using UCL.Forms;

namespace DBKit5.UControls
{
    /// <summary>
    /// 编辑Sql命令
    /// </summary>
    /// <remarks>2014-1-21 by sutroon</remarks>
    public partial class frmEditSql : Form
    {
        public string SqlText { get; set; }
        public string Fields { get; set; }
        public Action<string,Form> ExecuteSqlHandler { get; set; }
        public frmEditSql()
        {
            InitializeComponent();
        }

        private void frmEditSql_Load(object sender, EventArgs e)
        {
            tbSql.Text = SqlText;
            tbFields.Text = Fields;
            if (ExecuteSqlHandler == null)
            {
                btnRun.Visible = false;
            }
        }

        private void btnRun_Click(object sender, EventArgs e)
        {
            if (tbSql.TextLength > 0 && ExecuteSqlHandler!=null) ExecuteSqlHandler(tbSql.Text,this);
            this.Close();            
        }
    }
}
